 #include<stdio.h>
 int main()
 {  void scanf_ten(int *p);
    void process(int *p);
    void printf_ten(int *p);
    int  a[10];
    int *p=a;
    scanf_ten(p);
    process(p);
    printf_ten(p);
    return 0;
 }
 void scanf_ten(int *p)
 {
    for (int i=0;i<10;i++)
        scanf("%d",p+i);
 }
 void process(int *p) {
    int *max = p;
    int *min = p;

    for (int i = 0; i < 10; i++) {
        if (*(p + i) > *max) {
            max = p + i;
        }
        if (*(p + i) < *min) {
            min = p + i;
        }
    }

    if (max != p + 9) {
        int temp = *(p + 9);
        *(p + 9) = *max;
        *max = temp;
    }

    if (min != p) {
        int temp = *p;
        *p = *min;
        *min = temp;
    }
}
 void printf_ten(int *p)
 {
    for (int i=0;i<10;i++)
    printf("%d",*(p+i));
 }
